<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
<meta name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">

    <meta name="author" content="Janmas">



    <meta name="description" content="Janmas！一个又菜又爱玩的程序猿。不停的在立Flag，又一直在凭实力打着自己的脸。">


    <meta name="keywords" content="Janmas,Blog,墨鱼">


<title>
    Generate&amp;Deploy |
    
    Janmas</title>



    <link rel="icon" href="/favicon.ico">



    <!-- stylesheets list from _config.yml -->
    
        <link rel="stylesheet" href="/css/style.css">
    



    <!-- scripts list from _config.yml -->
    
        <script src="/js/script.js"></script>
    
        <script src="/js/tocbot.min.js"></script>
    



    
    
        
    



    <script src='https://unpkg.com/mermaid@7.1.2/dist/mermaid.min.js'></script>
    <script>
        if (window.mermaid) {
            mermaid.initialize({theme: 'forest'});
        }
    </script>


<meta name="generator" content="Hexo 5.4.1"></head>

<body>
    <script>
        // this function is used to check current theme before page loaded.
        (() => {
            const currentTheme = window.localStorage && window.localStorage.getItem('theme') || '';
            const isDark = currentTheme === 'dark';
            const pagebody = document.getElementsByTagName('body')[0]
            if (isDark) {
                pagebody.classList.add('dark-theme');
                // mobile
                document.getElementById("mobile-toggle-theme").innerText = "· Dark"
            } else {
                pagebody.classList.remove('dark-theme');
                // mobile
                document.getElementById("mobile-toggle-theme").innerText = "· Light"
            }
        })();
    </script>

    <div class="wrapper">
        <header>
    <nav class="navbar">
        <div class="container">
            <div class="navbar-header header-logo"><a href="/">Janmas&#39;s Blog</a></div>
            <div class="menu navbar-right">
                
                    <a class="menu-item" href="/archives">Posts</a>
                
                    <a class="menu-item" href="/category">Categories</a>
                
                    <a class="menu-item" href="/tag">Tags</a>
                
                <input id="switch_default" type="checkbox" class="switch_default">
                <label for="switch_default" class="toggleBtn"></label>
            </div>
        </div>
    </nav>

    
    <nav class="navbar-mobile" id="nav-mobile">
        <div class="container">
            <div class="navbar-header">
                <div>
                    <a href="/">Janmas&#39;s Blog</a><a id="mobile-toggle-theme">·&nbsp;Light</a>
                </div>
                <div class="menu-toggle" onclick="mobileBtn()">&#9776; Menu</div>
            </div>
            <div class="menu" id="mobile-menu">
                
                    <a class="menu-item" href="/archives">Posts</a>
                
                    <a class="menu-item" href="/category">Categories</a>
                
                    <a class="menu-item" href="/tag">Tags</a>
                
            </div>
        </div>
    </nav>

</header>
<script>
    var mobileBtn = function f() {
        var toggleMenu = document.getElementsByClassName("menu-toggle")[0];
        var mobileMenu = document.getElementById("mobile-menu");
        if(toggleMenu.classList.contains("active")){
           toggleMenu.classList.remove("active")
            mobileMenu.classList.remove("active")
        }else{
            toggleMenu.classList.add("active")
            mobileMenu.classList.add("active")
        }
    }
</script>
            <div class="main">
                <div class="container">
    
    
        <div class="post-toc">
    <div class="tocbot-list">
    </div>
    <div class="tocbot-list-menu">
        <a class="tocbot-toc-expand" onclick="expand_toc()">Expand all</a>
        <a onclick="go_top()">Back to top</a>
        <a onclick="go_bottom()">Go to bottom</a>
    </div>
</div>

<script>
    document.ready(
        function () {
            tocbot.init({
                tocSelector: '.tocbot-list',
                contentSelector: '.post-content',
                headingSelector: 'h1, h2, h3, h4, h5',
                collapseDepth: 1,
                orderedList: false,
                scrollSmooth: true,
            })
        }
    )

    function expand_toc() {
        var b = document.querySelector(".tocbot-toc-expand");
        tocbot.init({
            tocSelector: '.tocbot-list',
            contentSelector: '.post-content',
            headingSelector: 'h1, h2, h3, h4, h5',
            collapseDepth: 6,
            orderedList: false,
            scrollSmooth: true,
        });
        b.setAttribute("onclick", "collapse_toc()");
        b.innerHTML = "Collapse all"
    }

    function collapse_toc() {
        var b = document.querySelector(".tocbot-toc-expand");
        tocbot.init({
            tocSelector: '.tocbot-list',
            contentSelector: '.post-content',
            headingSelector: 'h1, h2, h3, h4, h5',
            collapseDepth: 1,
            orderedList: false,
            scrollSmooth: true,
        });
        b.setAttribute("onclick", "expand_toc()");
        b.innerHTML = "Expand all"
    }

    function go_top() {
        window.scrollTo(0, 0);
    }

    function go_bottom() {
        window.scrollTo(0, document.body.scrollHeight);
    }

</script>
    

    
    <article class="post-wrap">
        <header class="post-header">
            <h1 class="post-title">Generate&amp;Deploy</h1>
            
                <div class="post-meta">
                    
                        Author: <a itemprop="author" rel="author" href="/">Janmas</a>
                    

                    
                        <span class="post-time">
                        Date: <a href="#">January 10, 2022&nbsp;&nbsp;16:09:53</a>
                        </span>
                    
                    
                </div>
            
        </header>

        <div class="post-content">
            <p>测试generate后直接部署到码云</p>
<blockquote>
<p>gitee的Pages服务不像Github的Pages服务一样可以自动更新 所以提供了三种方案；如下：</p>
</blockquote>
<h3 id="方案一："><a href="#方案一：" class="headerlink" title="方案一："></a>方案一：</h3><ul>
<li>使用 puppeteer 操作浏览器进行更新按钮点击</li>
</ul>
<p>具体操作：<a href="https://yang0033.gitee.io/2020/07/07/gitee-page-%E6%97%A0%E6%B3%95%E8%87%AA%E5%8A%A8%E6%9B%B4%E6%96%B0/">解决 gitee page 无法自动更新| SuperYang’s Blog</a></p>
<h3 id="方案二："><a href="#方案二：" class="headerlink" title="方案二："></a>方案二：</h3><ul>
<li>使用github搭建博客</li>
</ul>
<p>具体操作：<a href="https://zhuanlan.zhihu.com/p/28321740">使用github的Pages服务 | 会飞的猪</a></p>
<h3 id="方案三："><a href="#方案三：" class="headerlink" title="方案三："></a>方案三：</h3><ul>
<li>通过wehook部署到第三方服务器</li>
</ul>
<p><code>（挖坑后续再更操作方法）</code></p>
<h3 id="方案四："><a href="#方案四：" class="headerlink" title="方案四："></a>方案四：</h3><ul>
<li>wehook+python自动化爬虫</li>
</ul>
<p><code>我py玩的不是太好暂且先用着吧</code></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><span class="line">import os.path</span><br><span class="line">import time</span><br><span class="line"></span><br><span class="line">from selenium import webdriver</span><br><span class="line">from webdriver_manager.chrome import ChromeDriverManager</span><br><span class="line">from selenium.webdriver.common.by import By</span><br><span class="line"></span><br><span class="line">fileName = &#x27;./timestamp.json&#x27;</span><br><span class="line">timestamp = 0</span><br><span class="line">if os.path.exists(fileName):</span><br><span class="line">    timestamp = open(fileName, &#x27;r&#x27;).read()</span><br><span class="line">    timestamp = int(timestamp) if len(timestamp) &gt; 0 else 0</span><br><span class="line"></span><br><span class="line">if (time.time_ns()-timestamp) &lt; 60 :</span><br><span class="line">    print(&quot;更新太过频繁，程序将自动休眠一段时间&quot;)</span><br><span class="line">    time.sleep(int(time.time() - timestamp))</span><br><span class="line"></span><br><span class="line">domain = &#x27;https://gitee.com/login&#x27;</span><br><span class="line">option = webdriver.ChromeOptions()</span><br><span class="line">option.add_argument(&#x27;--headless&#x27;)</span><br><span class="line">option.add_argument(</span><br><span class="line">    &#x27;User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.55&#x27;)</span><br><span class="line">browser = webdriver.Chrome(ChromeDriverManager().install(), options=option)</span><br><span class="line">browser.implicitly_wait(1)</span><br><span class="line">indexHtml = browser.get(domain)</span><br><span class="line">usernameInput = browser.find_element(By.XPATH, &quot;//input[@name=&#x27;user[login]&#x27;]&quot;)</span><br><span class="line">usernameInput.send_keys(&#x27;账号名&#x27;)</span><br><span class="line">time.sleep(2)</span><br><span class="line">passwdInput = browser.find_element(By.ID, &quot;user_password&quot;)</span><br><span class="line">passwdInput.send_keys(&#x27;密码&#x27;)</span><br><span class="line">time.sleep(2)</span><br><span class="line">result = browser.find_element(By.XPATH, &#x27;//input[@name=&quot;commit&quot;]&#x27;).click()</span><br><span class="line">browser.implicitly_wait(2)</span><br><span class="line">href = browser.find_element(By.XPATH, &quot;//a[@title=&#x27;仓库名&#x27;]&quot;).get_attribute(&#x27;href&#x27;)</span><br><span class="line">browser.get(href)</span><br><span class="line">browser.implicitly_wait(2)</span><br><span class="line">href = browser.find_element(By.XPATH, &#x27;/html/body/div[3]/div[1]/div[3]/div/div/div[2]/div/div[2]/a[1]&#x27;).get_attribute(</span><br><span class="line">    &#x27;href&#x27;)</span><br><span class="line">browser.get(href)</span><br><span class="line">browser.find_element(By.XPATH, &#x27;//*[@id=&quot;pages-branch&quot;]/div[6]&#x27;).click()</span><br><span class="line">confirm = browser.switch_to.alert</span><br><span class="line">time.sleep(1)</span><br><span class="line">confirm.accept()</span><br><span class="line">time.sleep(6)</span><br><span class="line">browser.quit()</span><br><span class="line">open(fileName, &#x27;w&#x27;).write(str(time.time_ns()))</span><br><span class="line">print(&quot;执行完成&quot;)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>



<p>我现在的操作流程：交代码-&gt;打开浏览器-&gt;进码云-&gt;找到仓库-&gt;打开giteePages服务-&gt;点击更新 -&gt;等更新完。</p>
<p>(lll￢ω￢)。太麻烦了好吧！</p>

        </div>

        
            <section class="post-copyright">
                
                
                
                

            </section>
        
        <section class="post-tags">
            <div>
                <span>Tag(s):</span>
                <span class="tag">
                    
                </span>
            </div>
            <div>
                <a href="javascript:window.history.back();">back</a>
                <span>· </span>
                <a href="/">home</a>
            </div>
        </section>
        <section class="post-nav">
            
                <a class="prev" rel="prev" href="/2022/01/13/Markdown%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/">Markdown基础语法</a>
            
            
            <a class="next" rel="next" href="/2022/01/10/Composer%E6%BA%90%E9%9B%86%E5%90%88/">Composer源集合</a>
            
        </section>


    </article>
</div>

            </div>
            <footer id="footer" class="footer">
    <div class="copyright">
        <span>© Janmas | Powered by <a href="https://hexo.io" target="_blank">Hexo</a> & <a href="https://github.com/Siricee/hexo-theme-Chic" target="_blank">Chic</a></span>
    </div>
</footer>



    </div>
</body>

</html>